home *** CD-ROM | disk | FTP | other *** search
- /************************* CDEMO.CPP *********************************
- * *
- * Simple Demo Program for *
- * C M A T H *
- * *
- * Copyright 1996-1999 by Martin Sander *
- * *
- * This sample program provides a very basic test *
- * for the correct installation of CMATH. *
- * *
- **************************************************************************/
-
- /* The include-file search path must contain
- \YourCMATHDirectory\include;
- The library search path must contain
- \YourCMATHDirectory\lib;
- (in addition to the compiler's default settings).
-
- Create a project with the following entries:
- CDEMO.CPP
- CMATHL3.LIB (Borland C++, DOS),
- or CMATHL3W.LIB (Borland C++, Windows 3.x, EasyWin),
- or VCF3W.LIB or CMATHF3W.LIB (Borland C++, Win32, console model;
- choose static linking and single-thread)
- or OVVCSD.LIB or CMVCSD.LIB (Microsoft Visual C++; Win32 console app;
- choose single-thread debug)
-
- Additionally, you have to link in the standard run-time libraries
- (BC++ 3.x: use Options/Linker/Libraries;
- BC++ 4.x, 5.x, etc.: use TargetExpert;
- MSVC: done automatically)
- */
-
- #include <newcplx.h>
- #include <stdio.h>
-
- NEWMATHERR // this macro has an effect only in BC, 16-bit
- int main( void )
- {
- fComplex x, y;
- x = sin( fComplex( 3, 5));
- y = inv( fComplex(0,0)); // will produce an error message
- printf( "x: {%f, %f}\n"
- "y: {%g, %g}\n", x.Re, x.Im, y.Re, y.Im );
- return 0;
- }
-